﻿@addTagHelper *, WebVella.Erp.Plugins.Core
@addTagHelper *, WebVella.Erp.Web
@addTagHelper *, WebVella.TagHelpers
@using WebVella.Erp.Web.Utils;
@using WebVella.Erp.Web;
@using WebVella.Erp.Web.Components;
@using WebVella.Erp.Api.Models;
@using WebVella.Erp.Web.Models;
@using WebVella.TagHelpers.Models;
@{
	var options = (PcRow.PcRowOptions)ViewBag.Options;
	var flexSelfAlignTypeOptions = (List<WvSelectOption>)ViewBag.FlexSelfAlignTypeOptions;
	var flexVerticalAlignmentOptions = (List<WvSelectOption>)ViewBag.FlexVerticalAlignmentOptions;
	var flexHorizontalAlignmentOptions = (List<WvSelectOption>)ViewBag.FlexHorizontalAlignmentOptions;
	var erpRequest = (ErpRequestContext)ViewBag.RequestContext;
}
<wv-row>
	<wv-column span="4">
		<wv-field-number min="1" max="12" name="visible_columns" value="@options.VisibleColumns" label-text="Visible Columns"></wv-field-number>
	</wv-column>
	<wv-column span="4">
		<wv-field-text name="class" value="@options.Class" label-text="Class"></wv-field-text>
	</wv-column>
	<wv-column span="4">
		<wv-field-checkbox name="no_gutters" value="@options.NoGutters" label-text="Padding" text-true="columns has no padding"></wv-field-checkbox>
	</wv-column>
</wv-row>
<wv-row>
	<wv-column span="4">
		<wv-field-select name="flex_vertical_alignment" value="@((int)options.FlexVerticalAlignment)" label-text="Flex Vertical Alignment" options="flexVerticalAlignmentOptions" required="true"></wv-field-select>
	</wv-column>
	<wv-column span="4">
		<wv-field-select name="flex_horizontal_alignment" value="@((int)options.FlexHorizontalAlignment)" label-text="Flex Horizontal Alignment" options="flexHorizontalAlignmentOptions" required="true"></wv-field-select>
	</wv-column>
</wv-row>


@for (int i = 1; i < 13; i++)
		{
	var containerId = "section-" + (options.GetType().GetProperty($"Container{i}Id").GetValue(options, null) ?? "").ToString();
	var containerSpan = (int?)options.GetType().GetProperty($"Container{i}Span").GetValue(options, null);
	var containerSpanSm = (int?)options.GetType().GetProperty($"Container{i}SpanSm").GetValue(options, null);
	var containerSpanMd = (int?)options.GetType().GetProperty($"Container{i}SpanMd").GetValue(options, null);
	var containerSpanLg = (int?)options.GetType().GetProperty($"Container{i}SpanLg").GetValue(options, null);
	var containerSpanXl = (int?)options.GetType().GetProperty($"Container{i}SpanXl").GetValue(options, null);

	var containerOffset = (int?)options.GetType().GetProperty($"Container{i}Offset").GetValue(options, null);
	var containerOffsetSm = (int?)options.GetType().GetProperty($"Container{i}OffsetSm").GetValue(options, null);
	var containerOffsetMd = (int?)options.GetType().GetProperty($"Container{i}OffsetMd").GetValue(options, null);
	var containerOffsetLg = (int?)options.GetType().GetProperty($"Container{i}OffsetLg").GetValue(options, null);
	var containerOffsetXl = (int?)options.GetType().GetProperty($"Container{i}OffsetXl").GetValue(options, null);
	var containerFlexSelftAlign = options.GetType().GetProperty($"Container{i}FlexSelftAlign").GetValue(options, null) ?? WvFlexSelfAlignType.None;
	var containerFlexOrder = (int?)options.GetType().GetProperty($"Container{i}FlexOrder").GetValue(options, null);

	<wv-section id="@containerId" title="@($"Column {i}")" class="mt-3 @(options.VisibleColumns > (i-1) ? "" : "d-none")" title-tag="h5" is-collapsable="true">
		<wv-row>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_span")" min="1" max="12" value="@containerSpan" label-text="Span"></wv-field-number>
			</wv-column>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_span_sm")" min="1" max="12" value="@containerSpanSm" label-text="Span Sm"></wv-field-number>
			</wv-column>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_span_md")" min="1" max="12" value="@containerSpanMd" label-text="Span Md"></wv-field-number>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_span_lg")" min="1" max="12" value="@containerSpanLg" label-text="Span Lg"></wv-field-number>
			</wv-column>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_span_xl")" min="1" max="12" value="@containerSpanXl" label-text="Span Xl"></wv-field-number>
			</wv-column>
			<wv-column span="4">

			</wv-column>
		</wv-row>

		<wv-row>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_offset")" min="1" max="12" value="@containerOffset" label-text="Offset"></wv-field-number>
			</wv-column>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_offset_sm")" min="1" max="12" value="@containerOffsetSm" label-text="Offset Sm"></wv-field-number>
			</wv-column>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_offset_md")" min="1" max="12" value="@containerOffsetMd" label-text="Offset Md"></wv-field-number>
			</wv-column>
		</wv-row>

		<wv-row>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_offset_lg")" min="1" max="12" value="@containerOffsetLg" label-text="Offset Lg"></wv-field-number>
			</wv-column>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_offset_xl")" min="1" max="12" value="@containerOffsetXl" label-text="Offset Xl"></wv-field-number>
			</wv-column>
			<wv-column span="4">

			</wv-column>
		</wv-row>

		<wv-row>
			<wv-column span="4">
				<wv-field-select name="@($"container{i}_flex_self_align")" value="@containerFlexSelftAlign" label-text="Flex Self Alignment" options="flexSelfAlignTypeOptions" required="true"></wv-field-select>
			</wv-column>
			<wv-column span="4">
				<wv-field-number name="@($"container{i}_flex_order")" min="1" max="12" value="@containerFlexOrder" label-text="Flex Order"></wv-field-number>
			</wv-column>
			<wv-column span="4">

			</wv-column>
		</wv-row>
	</wv-section>

}